<script type="text/javascript">
    var xmlhttp;

    function ajaxpopulate(selectBox) {
  
        var url = "query.php?option=1&value=" + + "&selBox=1";
        xmlhttp = null;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest;
        } else if (window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if (xmlhttp != null) {
            xmlhttp.onreadystatechange = state_Change;
            xmlhttp.open("GET", url, true);
            xmlhttp.send(null);
        } else {
            alert("Your browser does not support XMLHTTP.");
        }
        
       return 
    }

    function state_Change() {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                return xmlhttp.responseText;
            } else {
                return xmlhttp.statusText;
            }
        }
    }


function insertCategory(var categoryName){
ajaxpopulate();
}
</script>

Manage Category

<br>
<div id="AddCategory">
<form name="addcat" id="addcat" >
<input type="text" name="AddCategory" id="AddCategory"/>
<input type="button" name="Add" id="Add" value="Add Category" onClick="insertCategory(document.getElementById('Add'));"/>
</form>
</div>
<?php
require_once('../include_dao.php');
$arr = DAOFactory::getBooksDAO()->queryAll();
for($i=0;$i<count($arr);$i++){
   $row = $arr[$i];
   echo $row->categorymasterid.' '.$row->categoryname . '<br/><br/>';
}

foreach($result as $row){
	echo $row['categorymasterid'].'<----------->' .$row['categoryname'] ;
}

?>